package com.jerry.shop.mapper;

import com.jerry.shop.bean.Seller;
import org.apache.ibatis.annotations.*;

import java.util.List;

//这是Seller操作数据库的mapper
@Mapper
public interface SellerMapper {

    @Select("select * from t_seller")
    public List<Seller> getSellerList();

    @Select("select * from t_seller where id=#{id}")
    public Seller getSellerById(Integer id);

    @Select("select * from t_seller where username=#{username} and password=#{password}")
    public Seller getSellerByUsernameAndPassword(@Param("username") String username, @Param("password") String password);

    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into t_seller(username, password) values(#{username}, #{password})")
    public int insertSeller(Seller seller);

    @Update("update t_seller set username=#{username}, password=#{password} where id=#{id}")
    public int updateSeller(Seller seller);

    @Delete("delete from t_seller where id=#{id}")
    public int deleteSellerById(Integer id);

}
